package com.liao.product.controller;

import com.liao.common.entity.product.ProductImgsEntity;
import com.liao.common.utils.PageUtils;
import com.liao.product.service.ProductImgsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;


/**
 * 商品图片
 *
 * @author liao
 * @email 2858015963@qq.com
 * @date 2025-03-04 08:45:33
 */
@RestController
@RequestMapping("product/productimgs")
public class ProductImgsController {
    @Autowired
    private ProductImgsService productImgsService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public PageUtils<ProductImgsEntity> list(@RequestParam Map<String, Object> params) {
        return productImgsService.queryPage(params);

    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public ProductImgsEntity info(@PathVariable("id") Integer id) {
        return productImgsService.getById(id);

    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public void save(@RequestBody ProductImgsEntity productImgs) {
        productImgsService.save(productImgs);

    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public void update(@RequestBody ProductImgsEntity productImgs) {


        productImgsService.updateById(productImgs);

    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public void delete(@RequestBody Integer[] ids) {
        productImgsService.removeByIds(Arrays.asList(ids));

    }

}
